public class AbsoluteDiscountPricing implements ISalePricing{

	private double discount;
	private double threshold;
	
	public AbsoluteDiscountPricing(double discount, double threshold){
		this.discount = discount;
		this.threshold = threshold;
	}
	
	public double getTotal(Sale sale){
		double price = sale.getPreDiscountTotal()-discount;
		if(threshold>sale.getPreDiscountTotal())
			threshold=sale.getPreDiscountTotal();
		if(price>=threshold)
			return price;
		else return threshold;
	}
}
